import { ref } from 'vue'
export default function() {
  // 全局左键单击可关闭右键菜单
  window.onclick = closeMenu

  // 右键菜单打开与关闭
  let rightMenu = ref<any>(null)
  function rightClick(e: any) {
    rightMenu.value.changeMenuVisible(e)
  }
  function closeMenu() {
    if(!rightMenu.value) return
    rightMenu.value.closeMenu()
  }

  return {
    rightClick,
    closeMenu,
    rightMenu
  }
}